/**
 * @Description 宿舍管理service层
 * @author 20155870 杨润增
 * @create 2018-04-12 14:30
 **/
package com.campus_information_portal.service;

import com.campus_information_portal.entity.DorStuTerm;
import com.campus_information_portal.entity.DormitoryApplyForm;
import com.campus_information_portal.util.Message;
import com.campus_information_portal.util.Msg;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import java.net.UnknownHostException;
import java.util.Date;
import java.util.List;

/**
 * @author 20155870 杨润增
 * @className DomitoryService
 * @Description 宿舍管理service层
 * @create 2018-04-12 14:30
 **/

@Service
public interface DormitoryService {

    /**
     * @param
     * @Description 查询所有的申请
     * @author 20155870 杨润增
     * @methodName queryAllDormitoryApplyForm
     * @returnType List
     * @create 2018/5/3 8:39
     **/
    List<DormitoryApplyForm> queryAllDormitoryApplyForm();

    /**
     * @param
     * @Description 查询所有的申请
     * @author 20155870 杨润增
     * @methodName queryAllDormitoryApplyForm
     * @returnType List
     * @create 2018/5/3 8:39
     **/
    List<DorStuTerm> queryAllDormitoryApplyForm_2();

    /**
     * @param dormitory_apply_form_id
     * @Description 根据dormitory_apply_form_id查询申请表
     * @author 20155870 杨润增
     * @methodName queryDormitoryApplyFormById
     * @returnType DormitoryApplyForm
     * @create 2018/5/3 8:41
     **/
    DormitoryApplyForm queryDormitoryApplyFormById(int dormitory_apply_form_id);


    /**
     * @param term_id
     * @Description 根据term_id查询申请表
     * @author 20155870 杨润增
     * @methodName queryDormitoryApplyFormByTermId
     * @returnType DormitoryApplyForm
     * @create 2018/5/3 8:42
     **/
    DormitoryApplyForm queryDormitoryApplyFormByTermId(int term_id);


    /**
     * @param
     * @Description 根据学生id查询申请表
     * @author 20155870 杨润增
     * @methodName queryDormitoryApplyFormByStu_info_id
     * @returnType DormitoryApplyForm
     * @create 2018/5/3 8:43
     **/
    Msg<DorStuTerm> queryDormitoryApplyFormByStu_info_id(int stu_info_id);


    /**
     * @param
     * @Description 增加一条申请
     * @author 20155870 杨润增
     * @methodName addApply
     * @returnType int
     * @create 2018/5/3 9:57
     **/
    /*int addApply(DormitoryApplyForm dormitoryApplyForm);*/
    Msg addApply(int term_id, int stu_info_id, int dormitory_id, Date apply_date,
                 String apply_reason, Date start_date, Date end_date, int apply_state
    );

    Msg addApply_2(DormitoryApplyForm dormitoryApplyForm);

    Message addApply_3(Integer sutNum,String termYear, String termNum,
                   Date startDate, Date endDate,String reason);

    List<DormitoryApplyForm> query(DormitoryApplyForm dormitoryApplyForm);


    /**
     * @param dorStuTerm
     * @Description 多条件动态sql查询
     * @author 20155870 杨润增
     * @methodName queryApplyByConditions
     * @returnType List
     * @create 2018/5/6 14:07
     **/
    Msg<DorStuTerm> queryApplyByConditions(DorStuTerm dorStuTerm);

    Message queryApplyByConditions_2(DorStuTerm dorStuTerm);


    /**
     * @param
     * @Description 同意申请
     * @author 20155870 杨润增
     * @methodName agreeApply
     * @returnType Message
     * @create 2018/5/10 9:50
     **/

    Message agreeApply(int dormitoryApplyFormId);

    /**
     * @param
     * @Description 拒绝申请
     * @author 20155870 杨润增
     * @methodName refuseApply
     * @returnType Message
     * @create 2018/5/10 9:50
     **/

    Message refuseApply(int dormitoryApplyFormId);


    /**
     * @Description 根据stu_info_id查询dormitory_num
     * @author 20155870 杨润增
     * @methodName queryDormitoryNumByStuInfoId
     * @param stuInfoId
     * @returnType Msg
     * @create 2018/5/18 16:28
     **/
    Msg<DormitoryApplyForm> queryDormitoryNumByStuInfoId(int stuInfoId);

    /**
     * @Description 生成留宿证
     * @author 20155870 杨润增
     * @methodName download
     * @param stuName,stuSex,dormitoryNum,startDate,endDate
     * @returnType Message
     * @create 2018/5/21 17:27
     **/
    Message download(String stuName,String stuSex,int dormitoryNum,String startDate,String endDate) throws UnknownHostException;
}
